package com.young.shop.api.controller;

import com.young.shop.pojo.vo.BaseRespVO;

/**
 * Controller 父类
 */
public class BaseController {

	protected BaseRespVO convertSuccessResult(Object data) {
		BaseRespVO result = new BaseRespVO<>();

		result.setData(data);
		return result;
	}

	protected BaseRespVO convertSuccessResult() {
		BaseRespVO result = new BaseRespVO<>();
		return result;
	}

	protected BaseRespVO convertErrorResult(String errorMsg) {
		BaseRespVO result = new BaseRespVO<>();
		result.setCode(BaseRespVO.CodeType.FAILED.getValue());
		result.setMsg(errorMsg);
		return result;
	}
}
